/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.sadhar.sipp.application;

import java.util.ArrayList;
import java.util.List;
import org.sadhar.sia.framework.ClassApplicationModule;
import org.sadhar.sipp.login.Menu;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.Session;
import org.zkoss.zk.ui.Sessions;
import org.zkoss.zul.Div;
import org.zkoss.zul.Menubar;

/**
 *
 * @author hendro
 */
public class IndexWnd extends ClassApplicationModule {

    Div contentDiv;
    Menubar menubar;

    public IndexWnd() {
    }
    private Session sesi;
    private List<Menu> menus;

    public void onCreate() throws Exception {
        sesi = Sessions.getCurrent();
        menus = (ArrayList<Menu>) sesi.getAttribute("MENUS");
        contentDiv = (Div) getFellow("contentDiv");
        menubar = (Menubar)getFellow("menubar");

        //menu creation
//        for(Menu mnu : menus){
//            if(mnu.getParent()<0){
//                org.zkoss.zul.Menu root = new org.zkoss.zul.Menu();
//
//            }else{
//
//            }
//        }
    }

    public void showObject(String objName) {
        contentDiv.getChildren().clear();
        Executions.createComponents(objName, contentDiv, null);
    }
}
